# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Miles Alan <m@milesalan.com>
pkgname=lf
pkgver=31
pkgrel=1
pkgdesc="Terminal filemanager written in Go with vim-style keybindings"
options="chmod-clean net"
url="https://github.com/gokcehan/lf"
license="MIT"
arch="all"
makedepends="go"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-fish-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/gokcehan/lf/archive/r$pkgver.tar.gz"
builddir="$srcdir/lf-r$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v -o bin/$pkgname
}

check() {
	go test ./...
}

package() {
	install -Dm0755 bin/$pkgname -t "$pkgdir"/usr/bin

	# Manpages
	install -Dm0644 lf.1 "$pkgdir"/usr/share/man/man1/lf.1

	# .desktop file for menus
	install -Dm0644 lf.desktop -t "$pkgdir"/usr/share/applications

	# Shell completions
	install -Dm0644 etc/lf.bash "$pkgdir"/usr/share/bash-completion/completions/lf
	install -Dm0644 etc/lf.zsh "$pkgdir"/usr/share/zsh/site-functions/_lf
	install -Dm0644 etc/lf.fish -t "$pkgdir"/usr/share/fish/vendor_completions.d
}

sha512sums="
8029c5310d94be853d82b9fe6359853db37340231bd291dddc675d053d020a7a98f17931734bb65022278ccf3ab94513a6fdc0e37986388572fc4afff28e0380  lf-31.tar.gz
"
